import { Select } from 'antd';
import React, { forwardRef } from 'react';

const multiSelect = (props, ref) => {
  const Option = Select.Option;
  let {
    value,
    onChange = () => {},
    fieldProps = {},
  } = props;
  const { placeholder = '请选择', options = [] } = fieldProps

  return (
    <Select
      mode="multiple"
      allowClear
      value={value}
      style={{ width: '100%' }}
      placeholder={placeholder}
      onChange={(e) => {
        onChange(e);
      }}
      {...other}
    >
      {options.map((item) => (
        <Option value={item.value} key={item.value}>
          {item.label}
        </Option>
      ))}
    </Select>
  );
};

export default forwardRef(multiSelect);
